BigDFT.LogUtils module

Provides utilities for BigDFT logging events

format_iterable(iterable, exclude=None, indent: int = 1) str[source]

Recursive formatting of an iterable, producing log-safe string

Parameters
  • iterable (list, tuple, set, dict) – iterable to sort

  • exclude (list, optional) – keys to exclude

  • indent (int, optional) – indent level for recursion

Returns

newline separated string

Return type

(str)

class LogHandler(file: Optional[str] = None, level: Optional[str] = None, overwrite: Optional[bool] = None)[source]

Log handler for PyBigDFT events

Parameters
  • file (str) – Filename or absolute filepath

  • level (str) – String format of logging level: debug, info, …

  • overwrite (bool) – Overwrites the log file at instantiation. Appends, otherwise

This class allows updating of the logging features, and explicit log messages for debugging.

Before any BigDFT modules are imported, you have the opportunity to hook into the logger and change options:

>>> import BigDFT
>>> BigDFT.Logger.level = 'debug'  # set the log level to DEBUG
>>> BigDFT.Logger.overwrite = True  # force a new file each time
>>> BigDFT.Logger.path = './logs'  # place the log in a dir named 'log'
property level

Return the string format of the current logging level

property path

Attribute determining the current log path

property overwrite

Attribute determining the write mode of the logfiles

Set True before any logging is done to utilise a new file

debug(*args, **kwargs)[source]

Direct passthrough for debug logging method

info(*args, **kwargs)[source]

Direct passthrough for info logging method

warning(*args, **kwargs)[source]

Direct passthrough for warning logging method

error(*args, **kwargs)[source]

Direct passthrough for error logging method

critical(*args, **kwargs)[source]

Direct passthrough for critical logging method